package net.yw365;

import net.yw365.wxapkg.WxFile;
import net.yw365.wxapkg.WxPkgInputStream;

import java.io.*;

/**
 * Hello world!
 */
public class App extends Object{
    public static void main(String[] args) throws IOException {
        WxPkgInputStream inputStream = new WxPkgInputStream(new FileInputStream("58.wxapkg"));
        WxFile wxFile = null;
        while ((wxFile = inputStream.getNextWxFile()) != null) {
            System.out.println(wxFile);
            String name = wxFile.getName();
            File file = new File("/Users/farmer/IdeaProjects/wxapkg/5/", name);
            if (!file.getParentFile().exists()) {
                file.getParentFile().mkdirs();
            }
            OutputStream o = new FileOutputStream(file);
            inputStream.readWxFile(o);
        }
        inputStream.close();
        System.out.println("Hello World!");
    }
}
